import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { SafeUrl, DomSanitizer } from '@angular/platform-browser';

@Component({
  selector: 'app-course',
  templateUrl: './course.component.html',
  styleUrls: ['./course.component.less']
})
export class CourseComponent implements OnInit {

  dangerousUrl: string;
  safeUrl: SafeUrl;
  constructor(
    private route: ActivatedRoute,
    private sanitizer: DomSanitizer
  ) {
    this.dangerousUrl = 'javascript:alert(1);';
    this.safeUrl = this.sanitizer.bypassSecurityTrustUrl(this.dangerousUrl);




    route.paramMap.subscribe((pm: ParamMap) => {

      console.log(pm.get('id'));
      console.log(pm.get('username'));
      console.log(pm.get('age'));

    });

    route.queryParamMap.subscribe((qm: ParamMap) => {

      console.log(qm.get('a'));
      console.log(qm.get('b'));
    });


  }

  ngOnInit() {
  }

}
